// preload.js
const { contextBridge, ipcRenderer } = require("electron");

contextBridge.exposeInMainWorld("electron", {
  send: (channel, data) => {
    ipcRenderer.send(channel, data);
  },
  stream: (data) => {
    console.log("preload触发", data);
    ipcRenderer.send("start-stream", data);
  },
  stop: () => {
    console.log("preload触发");
    ipcRenderer.send("stop-stream");
  },
  getWindows: () => {
    ipcRenderer.send("get-windows");
  },
  receiveWindows: (func) => {
    ipcRenderer.on("windows-list", (event, ...args) => func(...args));
  },
  // 其他方法...
});
